package com.kb.mapper.es;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.kb.config.LambdaQueryWrapperX;
import com.kb.domain.gc.CategoryAggregationFieldDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * @author 国创工软
 */

@Mapper
public interface CategoryAggregationFieldMapper extends BaseMapper<CategoryAggregationFieldDO> {



    default List<CategoryAggregationFieldDO> selectListByType(Long fistCategoryId, Long secondCategoryId,
                                                              Long thirdCategoryId, int type) {
        return selectList(new LambdaQueryWrapperX<CategoryAggregationFieldDO>()
                .eqIfPresent(CategoryAggregationFieldDO::getFirstCategoryId, fistCategoryId)
                .eqIfPresent(CategoryAggregationFieldDO::getSecondCategoryId, secondCategoryId)
                .eqIfPresent(CategoryAggregationFieldDO::getThirdCategoryId, thirdCategoryId)
                .eqIfPresent(CategoryAggregationFieldDO::getAggregationType, type));
    }

    default List<CategoryAggregationFieldDO> selectListByFistCategoryIds(List<Long> secondCategoryIds, List<Long> thirdCategoryIds, int type) {
        return selectList(new LambdaQueryWrapperX<CategoryAggregationFieldDO>()
                .inIfPresent(CategoryAggregationFieldDO::getSecondCategoryId, secondCategoryIds)
                .inIfPresent(CategoryAggregationFieldDO::getThirdCategoryId, thirdCategoryIds)
                .eqIfPresent(CategoryAggregationFieldDO::getAggregationType, type));
    }
}
